package com.weixing.oauth2.common.authorize;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.Assert;

public final class MySimpleGrantedAuthority implements GrantedAuthority {
    private static final long serialVersionUID = 510L;


    private  String authority ;

    public MySimpleGrantedAuthority(String role) {
        Assert.hasText(role, "A granted authority textual representation is required");
        this.authority = role;
    }

    public MySimpleGrantedAuthority(){}

    @Override
    public String getAuthority() {
        return this.authority;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else {
            return obj instanceof MySimpleGrantedAuthority ? this.authority.equals(((MySimpleGrantedAuthority)obj).authority) : false;
        }
    }
    @Override
    public int hashCode() {
        return this.authority.hashCode();
    }
    @Override
    public String toString() {
        return this.authority;
    }
}